#ifndef _SBUS_SET_H
#define _SBUS_SET_H

#include "main.h"
#include "usart.h"

#define LD_SBUS_RX_BUF_NUM 50u

#define LD_RC_FRAME_LENGTH 25u

#define SBUS_CH_VALUE_OFFSET 1024

#define sbus_s_1 240   //最上边
#define sbus_s_2 1807  //最下边
#define sbus_s_3 1024  //中间

#define sbus_knob_zero 240

typedef struct 
{
	int16_t ch[16]; // 最多16个通道，多少通道开多少个数组
	char s[4];			//上边拨杆
	int16_t knob[2];//旋钮
}SBUS_t;

extern SBUS_t sbus_ch;									//转换的数据

void SBUS_Init(UART_HandleTypeDef *huart);
void rx_set(uint8_t *sbus_rx_buf,SBUS_t *sbus);
void SBUS_RxHandler(UART_HandleTypeDef *huart, uint16_t Size);

#endif

